package com.ws.admin.donate.controller;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.ws.admin.help.entity.Help;
import com.ws.common.base.BaseUtils;
import com.ws.common.constant.BaseConstants;
import com.ws.system.user.entity.SystemUser;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ws.admin.donate.entity.Donate;
import org.springframework.web.bind.annotation.RestController;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ws.common.result.entity.ResultEntity;

import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.ws.admin.donate.service.IDonateService;
import com.ws.common.base.BaseController;

/**
 * <p>
 * 捐赠信息表 前端控制器
 * </p>
 *
 * @author weifucheng
 * @since 2019-11-22
 */
@RestController
@RequestMapping("/donate")
public class DonateController extends BaseController<Donate> {

    @Autowired
    private IDonateService donateService;

    @RequestMapping("/list")
    public ResultEntity list(Donate donate, Integer current, Integer size){
        return ResultEntity.succes(donateService.list(donate, current, size));
    }

    @RequestMapping("/save")
    public ResultEntity save(Donate donate){
        return ResultEntity.succes(donateService.save(donate,this.getLoginUser()));
    }

    @RequestMapping("/readByMap")
    public ResultEntity readByMap(Donate donate){
        return ResultEntity.succes(donateService.readByMap(BeanUtil.toBean(donate, HashMap.class)));
    }

    @RequestMapping("/listRank")
    public ResultEntity listRank(Donate donate,Integer current, Integer size){
        return ResultEntity.succes(donateService.listRank(donate,current,size));
    }

}
